<template>
  <view class="item_block">
    <view class="item_block_2" @click="toSign">
      <image class="img" mode="scaleToFill" src="../../assets/images/notify/notify_icon.png"></image>
      <view class="right_content">
        <view class="top">
          <view class="title">承运单签名通知</view>
<!--          <view class="datetime">{{ transferTime(props.item.billingTime) }}</view>-->
          <view class="datetime">{{ transferTime(props.item.time) }}</view>
        </view>
        <view class="bottom">
          您有{{ props.item.count===1 ? '1' : '多' }}单待签名运单，请及时签名确认！
<!--          您有1单待签名运单，请及时签名确认！-->
        </view>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import Taro from "@tarojs/taro"
import { ref, defineProps } from 'vue'
import dayjs from "dayjs"
import {$post} from "@/@api";
import useMyOrderStore from "@/store/myOrder";
const props = defineProps<{
  item: any
  index: number
}>()
const orderStore = useMyOrderStore()
const toSign = async()=>{
  let res: any = await $post(
      "/selfmachine-system/order/list",
      {
        billNo: props.item.billNo,
      }
  )
  orderStore.orderList = res.data.rows[0]
  Taro.navigateTo({
    url: '/pages/sign/confirm?billNo='+props.item.billNo
  })
}
function transferTime(time){
  return dayjs(time).format('YYYY-MM-DD')
}
</script>

<style lang="scss">
.item_block {
  width: 100%;
  padding: 0 32rpx;
  box-sizing: border-box;
  background-color: #fff;
}
.item_block_2 {
  width: 100%;
  padding: 24rpx 0;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2rpx solid #f5f5f5;
  .img {
    width: 88rpx;
    height: 88rpx;
  }
  .right_content {
    width: calc(100% - 112rpx);
    display: flex;
    justify-content: center;
    flex-direction: column;
    .top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .title {
        font-size: 32rpx;
        color: #252525;
      }
      .datetime {
        font-size: 24rpx;
        color: #c4c4c4;
      }
    }
    .bottom {
      width: 100%;
      margin-top: 12rpx;
      font-size: 24rpx;
      color: #666;
      text-overflow: ellipsis;
      white-space: nowrap;
      overflow: hidden;
    }
  }
}
</style>
